package cn.git.led.test;


import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;

import java.util.Calendar;

/**
 * @author Yang Shuai
 * {@code @create} 2023/5/5:10:45
 * {@code @desc} |
 **/

public class testTime {
    String start_time= "10:43:00";
    public static void main(String[] args) {

        String s = DateUtil.formatTime(DateUtil.date());

        System.out.println(s);


        DateTime start_date= DateUtil.parseDate("2018/12/31");


        Calendar calendar=Calendar.getInstance();
        calendar.setTime(start_date);
        calendar.add(Calendar.DATE, 1);
        //设置系统时间
//				boolean b = WindowsSetSystemTime.setDateTimeBat(start_time, start_date.toDateStr());

        String format = DateUtil.format(calendar.getTime(), "yyyy/MM/dd");
        System.out.println(format);

        try{
            /**
             * 获取操作系统的名称
             * */
            String name = System.getProperty("os.name");
            if(name.contains("Windows")){    // Window 操作系统
                String cmd = " cmd /c time 19:50:00";
                Runtime.getRuntime().exec(cmd); // 修改时间
                cmd = " cmd /c date 2012-01-02";
                Runtime.getRuntime().exec(cmd); // 修改日期
                System.out.println(cmd);
            }
        }catch(Exception e){
            e.printStackTrace();
        }

    }
}
